import IRequestVO from '@/model/vo/request/IRequestVO'
import { getNameByValueAndDictList, handlerRegion } from '@/util/CommonUtil'
import { OptionProps } from '@douyinfe/semi-ui/lib/es/select'

export default (dictList: OptionProps[]) => [
  { title: '接口名', dataIndex: 'name' },
  { title: 'uri', dataIndex: 'uri' },
  { title: '用户名', dataIndex: 'userName' },
  { title: 'ip', dataIndex: 'ip' },
  {
    title: 'ip区域',
    dataIndex: 'region',
    render: (text: any, record: IRequestVO, index: number) => {
      return handlerRegion(record.region!)
    },
  },
  {
    title: '来源',
    dataIndex: 'category',
    render: (text: any, record: IRequestVO, index: number) => {
      return getNameByValueAndDictList(dictList, record.category!)
    },
  },
  { title: '耗时（字符串）', dataIndex: 'time' },
  { title: '耗时（毫秒）', dataIndex: 'timeNumber' },
  { title: '创建时间', dataIndex: 'createTime', sorter: true },
]
